﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using AuctionSite.App_Code.Modelos;
using System.Data.SqlClient;
namespace AuctionSite.App_Code.DAL
{
    public class LoginDAL
    {
        public void validar(Logins login)
        {
            SqlConnection cn = new SqlConnection();
            try
            {
                
                cn.ConnectionString = Dados.StringDeConexao;
                //command
                SqlCommand cmd = new SqlCommand();
                cmd.Connection = cn;
                
                cmd.CommandText = "SELECT * FROM usuarios WHERE usu_email=@usu_email AND usu_senha=@usu_senha)";

                
                cmd.Parameters.AddWithValue("@usu_email", login.Usu_login);
                cmd.Parameters.AddWithValue("@usu_senha", login.Usu_senha);
                
                cn.Open();
               cmd.ExecuteNonQuery();
                


               

            }
            catch (SqlException ex)
            {
                throw new Exception("Servidor SQL Erro:" + ex.Number);
            }
            catch (Exception ex)
            {
                throw new Exception("Erro:" + ex.Message);
            }
        }
    }
}